# Metview Macro

#  **************************** LICENSE START ***********************************
# 
#  Copyright 2015 ECMWF. This software is distributed under the terms
#  of the Apache License version 2.0. In applying this license, ECMWF does not
#  waive the privileges and immunities granted to it by virtue of its status as
#  an Intergovernmental Organization or submit itself to any jurisdiction.
# 

gp = read("geopoints.gpt")
print('Num points: ', count(gp))
print('Min value: ', minvalue(gp))
print('Max value: ', maxvalue(gp))

#write('geopoints_times_100.gpt', gp*100)
#return gp*100

location = [41.225, -4.807] # lat,lon

distances = distance(gp, location)

#return distances
#return distances < 100000

close_points = filter(gp, distances<100000)
return close_points


